﻿
	/***************** 定义左边树 ********************/
 	Ext.BLANK_IMAGE_URL = "extjs/resources/images/default/s.gif";
	// 一级导航
	var root = new Ext.tree.TreeNode({
		id:"root",
		text:"根节点"
	});
	
	// 教师管理
	var menuTeacherManager = new Ext.tree.TreeNode({
		id:"menuTeacherManager",
		text:"教师管理",
		expanded:true
	});
	
	// 教师添加
	var teacherAddMenu = new Ext.tree.TreeNode({
		id:"teacherAddMenu",
		text:"教师添加",
		url: "dean/teacherAdd.jsp"
	});
	
	// 教师管理
	var teacherManageMenu = new Ext.tree.TreeNode({
		id:"teacherManageMenu",
		text:"教师管理",
		url: "user_list.jsp"
	});
	
	// 教师查询
	var teacherQueryMenu = new Ext.tree.TreeNode({
		id:"teacherQueryMenu",
		text:"教师查询",
		listeners:{
		}
	});
	menuTeacherManager.appendChild(teacherManageMenu);
	menuTeacherManager.appendChild(teacherAddMenu);
	menuTeacherManager.appendChild(teacherQueryMenu);
	
		// 学生管理
	var menuGraduateManager = new Ext.tree.TreeNode({
		id:"menuGraduateManager",
		text:"学生管理",
		expanded:true
	});
	
	// 学生添加
	var graduateAddMenu = new Ext.tree.TreeNode({
		id:"graduateAddMenu",
		text:"学生添加",
		listeners:{
			// "click":payOutManageFn
		}
	});
	
	// 学生管理
	var graduateManageMenu = new Ext.tree.TreeNode({
		id:"graduateManageMenu",
		text:"学生管理",
		listeners:{
		}
	});
	
	// 学生查询
	var graduateQueryMenu = new Ext.tree.TreeNode({
		id:"graduateQueryMenu",
		text:"学生查询",
		listeners:{
		}
	});
	menuGraduateManager.appendChild(graduateManageMenu);
	menuGraduateManager.appendChild(graduateAddMenu);
	menuGraduateManager.appendChild(graduateQueryMenu);
	
	root.appendChild(menuTeacherManager);
	root.appendChild(menuGraduateManager);
	

	/****************************定义其他模块*********************************************/

		var center = new Ext.TabPanel({
			region: "center",
			defaults: {autoScroll:true},//自动出现滚动条
			items:[{
				title: "首页",
				html: "欢迎使用本系统！",
				id: "welcome"
			}],
			enableTabScroll: true
		});
		center.setActiveTab("welcome");
		
		var north = new Ext.Panel({
			title:"论文答辩系统",
			region:"north",
			height:100,
			collapsible:false
			//html:"<br><center><font size = 6>论文答辩系统</font></center>"
		});
		
		var west = new Ext.tree.TreePanel({
			title:"导航栏",
			region:"west",
			width:200,
			border:true,
			rootVisible:false,
			root:root,
			collapsible:true,
			listeners: {
				"click": function(n){
					var url = n.attributes.url;
					alert(url);
					var id = n.attributes.id;
					if(url){
						if(center.getItem(id)){
						// 表示标签已打开,则激活
							center.setActiveTab(id);
						}else{
						// 表示标签还没有打开,创建新页面
						// 有url才打开页面
							var p = new Ext.Panel({
								title: n.attributes.text, // 标题就是节点的文本
								id: id, // 标签的ID和节点的ID一样
								//autoLoad: {url: url, scripts: true},
								html : "<iframe src=\"" + _url + "\" style='height:100%;width:100%;' frameborder=0></iframe>",
								closable: true
							});
							center.add(p);
							center.setActiveTab(p);
						}
					}
			}
		}
			//split:true				
		});
		var viewPort = new Ext.Viewport({
			title:"教务员管理",
			layout:"border",
			items:[
				north,west,center
			]
		});
		
		Ext.onReady(function(){
			Ext.BLANK_IMAGE_URL = "extjs/resources/images/default/s.gif";
			Ext.QuickTips.init();
			Ext.form.Field.prototype.msgTarget="qtip";
			viewPort.render(Ext.getBody());
		});